#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
using namespace std;
class Solution
{
public:
    short indegree[1001], outdegree[1001];
    vector<int> findRedundantDirectedConnection(vector<vector<int>> &edges)
    {
        int u, v;
        for (auto &edge : edges)
        {
            indegree[edge[1]]++;
            outdegree[edge[0]]++;
            if (indegree[edge[1]] >= 2)
            {
                u = edge[0], v = edge[1];
                break;
            }
        }
        return {u, v};
    }
};